#!/usr/bin/env python
from bottle import *
  
@route('/helloworld/:yourwords', methods=['GET', 'POST'])
def hello(yourwords):                                                            
     return 'hello world. ' + yourwords
  
from bottle import get, post, request
#@route('/login')
@get('/login')
def login_form():
     return '''<form method = "POST">
                 <input name="name" type="text" />
                 <input name="password" type="password" />
                 <input type="submit" value="Login" />
                 </form>'''
#@route('/login', method = 'POST')
@post('/login')
def login():
     name = request.forms.get('name')
     password = request.forms.get('password')
     if check_login(name, password):
         return '<p>Your login was correct</p>'
     else:
         return '<p>Login failed</p>'
def check_login(name, password):
     if name == 'test' and password == '123456':
         return True
     return False
  
  
run(host='localhost', port=8080) 